package student.aistar.proxy.demo01;

public class TeacherProxy implements ITeacherDao{
    ITeacherDao teacherDao = new TeacherDaoImpl();

    public TeacherProxy(ITeacherDao teacherDao) {
        this.teacherDao = teacherDao;
    }

    @Override
    public int save() {
        System.out.println("开启事务");
        teacherDao.save();
        System.out.println("关闭事务");
        return 0;
    }

    @Override
    public int delById(int id) {
        System.out.println("开启事务");
        teacherDao.delById(1);
        System.out.println("关闭事务");
        return 0;
    }
}
